<template>
  <el-form-item label="频道">
    <el-select v-model="form.region" placeholder="请选择频道">
      <el-option v-for='channel in channelList' 
                :key='channel.id' 
                :label='channel.name' 
                :value="channel.id"></el-option>
      <el-option label="频道二" value="beijing"></el-option>
    </el-select>
    {{calue}} - <button @click='hChange'>更改</button>
    </el-form-item>
</template>
<script>
/* 取回频道数据
把数据显示视图上 */
export default {
  name:'Channel',
  data () {
    return  {
      channelId:0,
      channelIdList:[]
    }
  },
  created(){
    this.loadChannels()
  },
  methods:{
    hChange () {
      //当前用户选中的值抛出来
      this.$emit( 'input', this.channelId )
    },
    async loadChannels(){
      const resylt = await this.$http({
        method:'GET',
        url:'/mp/v1_0/channels'
      })
    console.log('频道数据', result);
    this.channelList = result.data.data.channels
  }
}
}
</script>